<!DOCTYPE html>
<#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<html>
<head>
    <meta charset="utf-8">
    <title>型号代号维护
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .qbdms-TBinformation {
            margin-left: 0;
            font-size: 15px
        }
    </style>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv">
    <div class="qbdms-backDiv">
        <div class="layui-table-view-body" style="padding: 0 24px 24px;">
            <div class="qbdms-formTitle" style="border-bottom: 1px solid #E5F0FF">型号代号维护<i
                    class="qbdms-returnOn closeWindow">返回</i></div>

            <form class="layui-form formPreview" requrl="${ctx}/qbdms/wQbdXhdh/get"
                  style="padding:24px 0 0 120px" lay-filter="wQbdXhdhDataForm">
                <@fillDept.dept id="tbxx"/>
                <div style="width: 50%">
                    <label class="layui-form-label qbdms-label" title="型号代号">型号代号<span
                            style="color: red;">*</span></label>
                    <div class="layui-input-block qbdms-input">
                        <input type="text" placeholder="请输入" autocomplete="off" id="fModelcode"
                               class="layui-input textInput" name="fModelcode" maxlength="10" lay-verify="xhdh|required">
                    </div>
                </div>
                <div style="width: 50%">
                    <label class="layui-form-label qbdms-label" title="姓名">型号名称<span
                            style="color: red;">*</span></label>
                    <div class="layui-input-block qbdms-input">
                        <input type="text" placeholder="请输入" autocomplete="off"
                               class="layui-input textInput" lay-verify="required"
                               lay-reqtext="型号名称是必填项" name="fModelname" maxlength="10">
                    </div>
                </div>

                <div class="layui-hide">
                    <input type="text" name="id" placeholder="请输入"
                           autocomplete="off" class="layui-input " maxlength="50" fieldname="id">
                </div>

                <div class="layui-form-item" style="margin-top: 48px">
                    <p style="text-align: left;margin-left: 104px;">
                        <a lay-submit lay-filter="wQbdXhdh" class="layui-btn privateSubmit qbdms-oneBtn" requrl="${ctx}/qbdms/wQbdXhdh/save">提交</a>
                        <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn  layui-btn-sm btn-save qbdms-oneBtnLine">取消</button>
                    </p>
                </div>

            </form>
        </div>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>

    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','setter', 'propsHandle', 'laydate', 'jquery','commonDialog', 'common','publicMethods','qbdmsForm'], function () {
        // -----常量声明----------
        var $ = layui.jquery,
            laydate = layui.laydate,
            common = layui.common,
            setter = layui.setter,  // 配置信息
            propsHandle = layui.propsHandle,
            form = layui.qbdmsForm,
            publicMethods = layui.publicMethods;

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdXhdh/view/list';
        });

        form.verify({
            xhdh: function (value) {
                if (value.length < 1) {
                    return '型号代号不能为空';
                }
                var message = '';
                var datas = {f_xhdh: value, id: '${id}'};
                $.ajax({
                    type: "POST",
                    url: "${ctx}/qbdms/wQbdXhdh/getXhdh",
                    async: false, //改为同步请求
                    contentType: 'application/x-www-form-urlencoded',
                    data: datas,
                    dataType: "json",
                    success: function (data) {
                        if (!data) {
                            message = '此型号代号已存在，请重新输入！';
                        }
                    },
                    error: function () {
                        //函数体，数据发送错误时执行
                    }
                });
                if (message !== '')
                    return message;
            }
        });


        var runId = "${runId}";
        if (runId == null || runId == '') {
            $("#hideAndShow").show();
        }

        var common = layui.common;
        var index = parent.layer.getFrameIndex(window.name);
        common.updateForm({
            name: 'wQbdXhdhDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback: function (data) {

            },
            updateCallback: function (data) {
                if (common.filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
                        layer.close(index);
                        window.location.href = '${ctx}/qbdms/wQbdXhdh/view/list';
                    });
                } else {
                    layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'});
                }
                return false;
            }
        });


    });
</script>


</body>
</html>